[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 gettext()               Copy Text From Screen to Memory

 #include <conio.h>

 int        gettext(left,top,right,bottom,dest);
 int        left;
 int        top;
 int        right;
 int        bottom;
 void       *dest;

    gettext() copies the contents of a rectangular screen area bordered
    by absolute screen coordinates ('left','top'), ('right','bottom')
    into an area of memory pointed to by 'dest'.  The contents of the
    screen area are read sequentially from left to right, top to bottom.

    The number of bytes of memory needed to store the screen information
    is:

          #bytes = ('right' - 'left') x ('bottom' - 'top') x 2

    This is because each screen position takes 2 bytes of memory. (The
    first byte is the cell character and the second is the cell's video
    attribute.)

       Returns:     1, if successful. 0 is returned on failure.

   Portability:     IBM PC and BIOS compatibles only.

   -------------------------------- Example ---------------------------------

    The following statements fill part of the screen with characters,
    store those characters in memory and put them back on the screen in a
    different place.

           #include <conio.h>

           main()
           {
               char buffr[20*10*2];
               int x, y;

               for (y = 0; y < 9; y++) {
                   for (x = 0; x < 19; x++)
                       printf("d");
                   printf("\n");
               }
               gettext(1,1,20,10,buffr);
               getch();
               clrscr();
               puttext(30,12,49,21,buffr);
           }


See Also: movetext() puttext()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson